home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CHARTP10.ARJ / TREE.H < prev   
C/C++ Source or Header  |  1992-01-26  |  1KB  |  59 lines

  1.  
  2. // Copyright 1992, David Perelman-Hall & Jamshid Afshar
  3.  
  4. #ifndef TREE_H
  5. #define TREE_H
  6.  
  7. #include "category.h"
  8.  
  9. class Tree;
  10. typedef Tree *Tptr;
  11. const int MAX_CHILDREN = 5;
  12.  
  13. class Tree {
  14. friend ostream& operator << ( ostream& os, const Tree& tree );
  15. private:
  16.    Category _cat;
  17.    Tptr _children[MAX_CHILDREN];
  18.    int _num_children;
  19. public:
  20.    //constructor
  21.    Tree( const Category& cat );
  22.  
  23.    //coppy constructor
  24.    Tree( const Tree &tree );
  25.  
  26.    //operator =
  27.    void operator = ( const Tree &tree );
  28.  
  29.    bool isvalid() const;
  30.  
  31.    //operator ==
  32.    bool operator == ( const Tree &tree ) const;
  33.  
  34.    //operator !=
  35.    bool operator != ( const Tree &tree ) const{
  36.       return !(*this == tree);
  37.    }
  38.  
  39.    //return category
  40.    const Category& cat() const {
  41.       return _cat;
  42.     }
  43.  
  44.    //destructor
  45.    ~Tree();
  46.  
  47.    //clear
  48.    void clear();
  49.  
  50.    //add
  51.    void add_child( const Tree &tree );
  52.  
  53.    //get children in current tree
  54.    Category_Sequence get_children() const;
  55.  
  56. };
  57.  
  58. #endif
  59.